/*
 *
100
test1
200
析构函数
test2 
析构函数
test3

 */

#include <iostream>
using namespace std;
class Integer{
	public:
		Integer(int i=0){
			m_pi = new int(i);
		}
		~Integer(void){
			cout << "析构函数" << endl;
			delete m_pi;
		}
		void print(void) const{
			cout <<*m_pi << endl;
		}
	private:
		int *m_pi;
};
int main(void){
	if(1){
		Integer i(100);
		i.print();

		cout << "test1" << endl;
		
		Integer *pi = new Integer(200);
		pi->print();
		delete pi;  //析构函数被调用
		
		cout << "test2 " << endl;

	}// i 的生命周期结束  对应的析构函数被调用
	
	cout << "test3" << endl;
	return 0;
}
